rm(list=ls())

library(spatstat)
library(plyr)
library(lattice)

source("set_up.R", encoding = "UTF-8")

# ## Load newly created data from working directory
load('ppm_data_new_afo_r6.RData')

ged.postsurv.r80 <- unmark(ged.postsurv.r80) # after 2018
ged.postsurv.r50 <- unmark(ged.postsurv.r50) # after 2018

log_pop.im <- log(pop.im +1)

r6_r80 <- ppm(ged.postsurv.r80 ~ internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


r6_r50 <- ppm(ged.postsurv.r50 ~  internet_freq.im + log_pop.im+ light.im  + 
                elev.im + urban.im)


save(r6_r50, r6_r80, file = "ppmoutcome_r6.RData")
